var fs = require("fs")

const express = require('express')
const { resourceUsage } = require('process')
const jwt = require("jsonwebtoken")
var actorIntroduceRouter = express.Router()

var axios = require("axios");

actorIntroduceRouter.get('/actorIntroduce', function (req, res) {
    if (req.session.token == undefined) {

        axios({
            url: "video/order/findAllVip",
            method: "post",
        })
            .then(function (data) {
                let allonevip = data.data.object
                res.render("front-stage/actorIntroduce.html", { userinfo: '' ,allonevip:allonevip})

            })
            .catch(function (error) {
                console.log(error)
            })


       
    }else{

        axios({
            url: "video/order/findAllVip",
            method: "post",
        })
            .then(function (data) {
                let allonevip = data.data.object
                res.render("front-stage/actorIntroduce.html", { userinfo: jwt.decode(req.session.token), allonevip: allonevip })

            })
            .catch(function (error) {
                console.log(error)
            })
       
    }
    
})



actorIntroduceRouter.get('/findActorMessage', function (req, res) { 
    axios({
        url: "video/actor/findActorMessage",
        params: {
            actorId: req.query.actorId,
        },
        method: "get",
    })
        .then(function (data) {
            res.status(200).json({
                data:data.data,
                message: '遍历演员信息成功'
            })
        })
        .catch(function (error) {
            console.log(error)
            res.status(500).json({
                message: '遍历演员信息失败'
            })
        })
})




module.exports = actorIntroduceRouter;